import React from 'react';
import Route from 'react-router/lib/Route';
import Home from './components/Home';
/** 商机 */
import SellChanceReport from './components/chance/Report';
/** 合同 */
import ContractReport from './components/contract/Report';
/** 产品 */
import ProductListReport from './components/product/ProductReportList';
/** 客户 */
import CustomerReport from './components/customer/CustomerReport';
import CustomerEvaListReport from './components/customer/CustomerEvaListReport';
/** 联系情况 */
import ContactLogReport from './components/contactLog/Report';
import AddressChart from './components/AddressChart';


import './style/index';
import stores from './stores';
import { WeaErrorPage, WeaLocaleProvider } from 'ecCom';

const getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(this, 'crm');

const getLabel = WeaLocaleProvider.getLabel;
class Error extends React.Component {
  render() {
    return (
      <WeaErrorPage ecId={`${this && this.props && this.props.ecId || ''}_WeaErrorPage@ct0wpx`} msg={getLabel(129417, '服务器运行出错，请联系系统管理员！')} />
    );
  }
}

const Routes = (
  <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@bg9w7r`} path="crmReport" component={Home} onEnter={getLocaleLabel}>
    {/* 商机相关 */}
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@1cynkt`} path="sellChance/:type" component={SellChanceReport} />
    {/* 合同相关 */}
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@d81k4j`} path="contract/:type" component={ContractReport} />
    {/* 产品、客户相关 */}
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@ha5zns`} path="product/list" component={ProductListReport} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@bkyy9l`} path="customer/evaList" component={CustomerEvaListReport} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@nrzbpw`} path="customer/:type" component={CustomerReport} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@xymjd7`} path="contactLog/list" component={ContactLogReport} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@j84afs`} path="address/chart" component={AddressChart} />
    <Route ecId={`${this && this.props && this.props.ecId || ''}_Route@n7s1w9`} path="*" component={Error} />
  </Route>
);

module.exports = {
  Route: Routes,
  store: stores,
};
